Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for nvim-treesitter/nvim-treesitter #253

Merged
merged 38 commits into from
Jul 10, 2021
Merged

Add support for nvim-treesitter/nvim-treesitter #253

merged 38 commits into from
Jul 10, 2021

Conversation

mrswats
Copy link
Contributor

@mrswats mrswats commented Mar 15, 2021

Resolves #235

It adds support for TreeSitter syntax highlighting.

arcticicestudio and others added 27 commits December 30, 2017 18:28
Co-Authored-By: Arctic Ice Studio <[email protected]>
line 13
…169)

The included theme bundles have not supported the "uniform status line" feature (GH-58), which allows to change the background color of the status bar (StatusLine) group to `nord3`.

Related to GH-58
Resolves GH-168
Added custom highlight groups of the `vim-startify` (1) plugin to adapt
to Nord's style.

References:
  (1) https://github.com/mhinz/vim-startify

Resolves GH-159
Vim version 8.1.2029 [1] added the `underline` attribute for the
`CursorLineNr` group to `cterm` [2] based on vim/vim#4933 [3].
This change resulted in gutter line numbers being underlined which has
now been reverted back to Nord's style by explicitly setting the
attribute for the group to `NONE`.

[1]: https://github.com/vim/vim/releases/tag/v8.1.2029
[2]: vim/vim@d9b0d83...017ba07#diff-80fffb3e9c20e93e5b2328a9a20e19c9
[3]: vim/vim#4933

Resolves GH-174
Added highlighting support for the build-in Neovim language server [1] using the coc.nvim [2] groups as reference.

[1]: https://github.com/neovim/nvim-lsp
[2]: https://github.com/neoclide/coc.nvim
…sole and GUI modes. (#202)

Consistent `Error` and `MoreMsg` highligh. in term and GUI mode (#202)

Before the `Error` group in GUI mode used `nord0` as foreground color
instead of `nord4` resulting in a bad contrast.

Also after checking  ( links to it)
Also since there was also no color defined for terminal mode for the
`MoreMsg` group (see `:help MoreMsg` that link to `:help more-prompt`)
Vim used the default color which was some kind of green.
To ensure it matches Nord's style it has now been changed to use `nord8`
(main accent color) for both terminal and GUI mode.
This can be tested by running `:echon "MESSAGE\n"` taht produces a lot
of lines that won't fit on the current screen space anymore.

Co-authored-by: Arctic Ice Studio <[email protected]>
Co-authored-by: Sven Greb <[email protected]>
The `LineNr` and `CursorLineNr` highlight groups now have a transparent
background in GUI mode.

Before it was set to `nord0_gui` which worked fine in most cases.
However, some plugins use these highlight groups to render their content
in a popup window which can potentially have a different background
color. This caused some issues e.g. for the fuzzy search plugin
LeaderF [1].

The compatibility with the `g:nord_cursor_line_number_background`
theme configuration has been verified to work as expected in both modes
when it is set to `0` or `1`.

This change is not related to the terminal mode or when using
`set notermguicolors` since `ctermbg` for `LineNr` and `CursorLineNr`
is set to `NONE` by default.

[1]: https://github.com/Yggdroot/LeaderF
Added highlighting support for the build-in Neovim language server [1] using the coc.nvim [2] groups as reference.

[1]: https://github.com/neovim/nvim-lsp
[2]: https://github.com/neoclide/coc.nvim
Basic highlighting support for TypeScript & TSX

Added basic support to highlight TypeScript & TSX syntax more
consistently through the HerringtonDarkholme/yats.vim plugin [1].
This includes improvements to highlight...

1. ...TypeScript interface an class names using `nord7` as foreground,
   where interfaces also use the bold attribute, to match with
   structs/classes.
2. ...global methods like e.g. `setTimeout` with `nord8` using the
   italic attribute to mark it kind of static. 
3. ...regular expressions with `nord13` as foreground color instead of
   the normal color for quoted strings (`nord14`) to make it easier to
   differ between both. 
4. ...global objects like `Error`, `JSON` and `console` with `nord7`.
5. ...primitive/builtin types like `string` with `nord9`.
6. ...TypeScript type references with `nord7`.
7. ...TypeScript specific characters like for type annotations (`:`) and
   member optionality (`?`) as operator with `nord9`.

This also includes improvements for "vanilla" JavaScript elements.

[1]: https://github.com/HerringtonDarkholme/yats.vim

Resolves GH-208

Co-authored-by: Arctic Ice Studio <[email protected]>
Co-authored-by: Sven Greb <[email protected]>
Added basic support for vim-clap [1], a modern and performant generic finder and dispatcher for Vim and NeoVim.

[1]: https://github.com/liuchengxu/vim-clap

GH-178

Co-authored-by: Arctic Ice Studio <[email protected]>
Co-authored-by: Sven Greb <[email protected]>
@dimas-cyriaco
Copy link

dimas-cyriaco commented Mar 15, 2021

Just tested it. In code files it seams ok, but on Startify screen its a bit off (this PR code is on the left).

Screen Shot 2021-03-15 at 14 09 26

Maybe it would be better to just add the 'treesitter' specific highlights (started with TS) and leave the others as they are?

@mrswats
Copy link
Contributor Author

mrswats commented Mar 15, 2021

@dimascyriaco I noticed that too. I took the files from the linked discussion and applied them here as is. Said that, you are right, maybe having just the Treesitter ones makes sense as for now. I will update the PR.

@mrswats
Copy link
Contributor Author

mrswats commented Mar 15, 2021

Another thing I noticed are docstrings in python. They don't seem to be parsed as strings but something else instead. I am unsure as to whether this belongs in this package, in the TreeSitter parser or somewhere else. Any pointers/help would be appreciated.

(That is in order to keep the same syntax higlighting style as the current non-TS version)

Ferran Jovell added 6 commits July 5, 2021 20:03
- Added if guards to only load them when in nvim and if treesitter is
  loaded
- Changed color definitions for varialbes defined at the top
- Using local s:hi function
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
@mrswats
Copy link
Contributor Author

mrswats commented Jul 7, 2021

@arcticicestudio I was wondering, added it in another comment if this PR makes any sense any more given that all that remains here is already done in treesitter.

Copy link
Contributor

@arcticicestudio arcticicestudio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrswats Thanks for the clean up ✨
I've added a couple of review comments and suggestions to clarify things and clean up unnecessary definitions.

colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
colors/nord.vim Outdated Show resolved Hide resolved
@arcticicestudio
Copy link
Contributor

I'll push commits to add the new custom syntax highlighting groups as soon as all review discussions are resolved, otherwise they might be marked as outdated again and the suggestions can not be merged.

@mrswats
Copy link
Contributor Author

mrswats commented Jul 7, 2021

I think I dealth with all your last set of changes!

I can squash all the commits so it's easier to review. At the view least I squashed all these changes that I made in github into one signle commit.

mrswats and others added 3 commits July 7, 2021 19:23
The new `Decorator` and `Annotation` groups can be used for decorators
like `@observe` in TypeScript for annotations like `@Override` in Java.
Additionally the new `Variable` group is a more clearly named group for
the `Identifier` group.

Co-authored-by: Sven Greb <[email protected]>

GH-253
Copy link
Contributor

@arcticicestudio arcticicestudio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, let's get this done.
Thanks to all contributors 👍🏻

⚠️ This is the first iteration and it is very likely that there will be inconsistencies compared to the current highlighting when using "normal" Vim plugins per language. Please report any problem you find so that the support for tree-sitter can be improved continuously!

@arcticicestudio arcticicestudio merged commit b3e712a into nordtheme:develop Jul 10, 2021
@arcticicestudio arcticicestudio changed the title Add Treesitter Support Add support for nvim-treesitter/nvim-treesitter Jul 10, 2021
@brymer-meneses
Copy link

This is nice! Thanks for the hard work everyone!

arcticicestudio pushed a commit that referenced this pull request Jul 10, 2021
Neovim version 0.5 [1] is a long-time awaited update that introduces
features like tree-sitter [2][3] support and native LSP [4][5].
Even though Neovim devides more and more from Vim through specific
features like first-class Lua support with custom APIs, the highlighting
for tree-sitter is achived through "normal" syntax highlighting groups.
Most of the groups are already linked by the nvim-treesitter plugin by
default [6] so only a few groups have been adjuated for now to fit the
Nord style.

[1]: https://github.com/neovim/neovim/releases/tag/v0.5.0
[2]: https://github.com/tree-sitter/tree-sitter
[3]: https://github.com/nvim-treesitter/nvim-treesitter
[4]: https://neovim.io/doc/user/lsp.html
[5]: https://github.com/neovim/nvim-lspconfig
[6]: https://github.com/nvim-treesitter/nvim-treesitter/blob/90f15d9/plugin/nvim-treesitter.vim

Co-authored-by: Ferran Jovell <[email protected]>
Co-authored-by: Arctic Ice Studio <[email protected]>
Co-authored-by: Sven Greb <[email protected]>

Closes GH-235
crispgm pushed a commit to crispgm/nord-vim that referenced this pull request Jul 14, 2021
Neovim version 0.5 [1] is a long-time awaited update that introduces
features like tree-sitter [2][3] support and native LSP [4][5].
Even though Neovim devides more and more from Vim through specific
features like first-class Lua support with custom APIs, the highlighting
for tree-sitter is achived through "normal" syntax highlighting groups.
Most of the groups are already linked by the nvim-treesitter plugin by
default [6] so only a few groups have been adjuated for now to fit the
Nord style.

[1]: https://github.com/neovim/neovim/releases/tag/v0.5.0
[2]: https://github.com/tree-sitter/tree-sitter
[3]: https://github.com/nvim-treesitter/nvim-treesitter
[4]: https://neovim.io/doc/user/lsp.html
[5]: https://github.com/neovim/nvim-lspconfig
[6]: https://github.com/nvim-treesitter/nvim-treesitter/blob/90f15d9/plugin/nvim-treesitter.vim

Co-authored-by: Ferran Jovell <[email protected]>
Co-authored-by: Arctic Ice Studio <[email protected]>
Co-authored-by: Sven Greb <[email protected]>

Closes nordthemeGH-235
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Treesitter support